package com.slz3.business.module.configManagement.conActivityForecast.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.configManagement.conActivityForecast.domain.ConActivityForecast;
import com.slz3.business.module.configManagement.conActivityForecast.domain.ConActivityForecastFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class ConActivityForecastTransactionalServiceImpl implements ConActivityForecastTransactionalService {

    @Override
    public ConActivityForecast modify(ConActivityForecast conActivityForecastNew) {
        Repositorys.conActivityForecast.test();
        Repositorys.conActivityForecast.save(ConActivityForecastFactory.initBaseFields());
        System.err.println(1/0);
        conActivityForecastNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.conActivityForecast.saveAndFlush(conActivityForecastNew);
    }

    @Override
    public List<ConActivityForecast> batchModify(List<ConActivityForecast> conActivityForecastList) {
        return Repositorys.conActivityForecast.saveAll(conActivityForecastList);
    }
}
